﻿@page
@model Remotely.Server.Pages.EditDeviceModel
@{
    ViewData["Title"] = "Edit Device";
}

@if (string.IsNullOrWhiteSpace(Model.DeviceName))
{
    <h3>Device not found.</h3>
}
else
{

    <div class="col-sm-8 offset-sm-2">
        @if (Model.SaveSucessful)
        {
            <div class="alert alert-success alert-dismissible" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
                Saved successfully.
            </div>
        }
        <h3>Edit Device</h3>
        <form method="post">
            <div asp-validation-summary="All" class="text-danger"></div>
            <div class="form-group row">
                <label for="device-name" class="col-sm-2 col-form-label">Device:</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="device-name" readonly value="@Model.DeviceName" />
                </div>
            </div>
            <div class="form-group row">
                <label for="device-id" class="col-sm-2 col-form-label">Device ID:</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="device-name" readonly value="@Model.DeviceID" />
                </div>
            </div>
            <div class="form-group row">
                <label for="agent-version" class="col-sm-2 col-form-label">Agent Version:</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="agent-verison" readonly value="@Model.AgentVersion" />
                </div>
            </div>
            <div class="form-group row">
                <label for="device-alias" class="col-sm-2 col-form-label">Device Alias:</label>
                <div class="col-sm-10">
                    <input id="device-alias" type="text" class="form-control" asp-for="Input.Alias" />
                    <span asp-validation-for="Input.Alias" class="text-danger"></span>
                </div>
            </div>
            <div class="form-group row">
                <label for="webrtc-setting" class="col-sm-2 col-form-label">WebRTC Setting:</label>
                <div class="col-sm-10">
                    <select id="webrtc-setting" asp-for="Input.WebRtcSetting" asp-items="@Html.GetEnumSelectList<Remotely.Shared.Enums.WebRtcSetting>()" class="form-control"></select>
                    <span asp-validation-for="Input.WebRtcSetting" class="text-danger"></span>
                </div>
             
            </div>
            <div class="text-right">
                <a asp-area="Identity" asp-page="/Account/Manage/Organization">Edit Groups</a>
            </div>
            <div class="form-group row">
                <label for="device-groups" class="col-sm-2 col-form-label">Device Group:</label>
                <div class="col-sm-10">
                    <select id="device-groups" asp-for="Input.DeviceGroupID" asp-items="@Model.DeviceGroups" class="form-control">
                        <option value="">None</option>
                    </select>
                    <span asp-validation-for="Input.DeviceGroupID" class="text-danger"></span>
                </div>
            </div>
            <div class="form-group row">
                <label for="tags" class="col-sm-2 col-form-label">Tags:</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" asp-for="Input.Tags" />
                    <span asp-validation-for="Input.Tags" class="text-danger"></span>
                </div>
            </div>
            <div class="form-group row">
                <label for="notes" class="col-sm-2 col-form-label">Notes:</label>
                <div class="col-sm-10">
                    <textarea asp-for="Input.Notes" class="form-control"></textarea>
                    <span asp-validation-for="Input.Notes" class="text-danger"></span>
                </div>
            </div>
            <div class="text-right">
                <button type="submit" class="btn btn-primary">Save</button>
                <button type="submit" class="btn btn-secondary" onclick="window.close()">Close</button>
            </div>
        </form>
    </div>

}
